package lanqiao.a2020_b组第二次省赛;

public class C {
    public static void main(String[] args) {
        int[][] t = new int[][]{
                {1, 1, 0, 0, 0, 1, 0}, //a
                {1, 1, 1, 0, 0, 0, 1}, //b
                {0, 1, 1, 1, 0, 0, 1}, //c
                {0, 0, 1, 1, 1, 0, 0}, //d
                {0, 0, 0, 1, 1, 1, 1}, //e
                {1, 0, 0, 0, 1, 1, 1}, //f
                {0, 1, 1, 0, 1, 1, 1}, //g
        };
        for (int i = 0; i < 7; i++) {
            dfs(t, i);
        }
        System.out.println(count);
    }

    public static int count = 0;

    public static void dfs(int[][] t, int next) {
        count++;
        for (int i = 0; i < 7; i++) {
            int n = t[next][i];
            if (n == 0 || t[i][i] == 0) {
                continue;
            }
            t[next][next] = 0;
            dfs(t, i);
            t[next][next] = 1;
        }
    }
}
